<div class="listBox clfx" style="width: 570px;">
    <form action="{:U('menu/action_save')}" target="simpleO2O_frm" method="post">
        <table cellpadding="0"  cellspacing="0" width="100%" class="rembertable">
            <tr>
                <th>菜单名称</th>
                <th>控制器</th>
                <th>排序</th>
                <th>是否显示</th>
                <th>操作</th>
            </tr>
            <tbody id="jq_action_list">
                <foreach name="datas" item="var">
                    <eq name="var.parent_id" value="$parent_id">
                        <tr>
                            <td><input type="text" name="data[{$var.menu_id}][menu_name]" value="{$var.menu_name}"  class="manageInput w100" /></td>
                            <td><input type="text" name="data[{$var.menu_id}][menu_action]" value="{$var.menu_action}" class="manageInput w100" /></td>
                            <td><input type="text" name="data[{$var.menu_id}][orderby]"    value="{$var.orderby}" class="manageInput w50" /></td>
                            <td>
                                <select name="data[{$var.menu_id}][is_show]" class="manageSelect w100">
                                    <option value="0" <eq name="var.is_show" value="0">selected="selected"</eq> >隐藏</option>
                                    <option value="1" <eq name="var.is_show" value="1">selected="selected"</eq> >显示</option>
                                </select>
                            </td>
                            <td>
                                {:BA('menu/delete', array("id" => $var['menu_id']), '删除', 'act', 'remberBtn')}
                            </td>
                        </tr>
                    </eq>
                </foreach>
            </tbody>
            <tr>
                <td colspan="5">
                    <input type="submit" class="remberSubmit" value="保存" />
                    <input type="hidden" name="parent_id" value="{$parent_id}"/>
                    <a href="javascript:void(0);" id="jq_action_add" class="remberBtn">新增一行</a>
                </td>
            </tr>
        </table>
    </form>

</div>

<script>
    $(document).ready(function(e){
        var action_num = 0;
        $("#jq_action_add").click(function(){
            action_num++;
            var html ='<tr id="menu_action_'+action_num+'"> ' +
                    '<td><input type="text" name="new['+action_num+'][menu_name]" value=""  class="manageInput w100"/></td>   ' +
                    '<td><input type="text" name="new['+action_num+'][menu_action]" value="" class="manageInput w100" /></td> ' +
                    '<td><input type="text" name="new['+action_num+'][orderby]" value="100" class="manageInput w50" /></td>' +
                    '<td><select name="new['+action_num+'][is_show]" class="manageSelect w100"> <option value="0">隐藏</option><option value="1">显示</option></select></td>' +
                    '<td><a href="javascript:void(0);" onclick="$(\'#menu_action_'+action_num+'\').remove();" class="remberBtn" >移除</a></td> ' +
                    '</tr>';
            $("#jq_action_list").append(html);
        });
    });
</script>

